<template>
	<view class="content">
		<view>
			<view class="cu-form-group">
				<view class="title">报价</view>
				<input placeholder="请输入预估价格" type="digit" name="input" :value="order_amount" @input="inputChange" data-name="order_amount" />
			</view>

			<view style=" padding: 20upx;">小提示：修改前请先联系需求方确认价格，以免造成不必要的纠纷</view>
			<view class="box margin-top-20" style=" padding: 20upx;">
				<button @click="postForm" class="cu-btn block bg-blue margin-tb-sm lg">
					<text :class="loadding == 1 ? 'cuIcon-loading2 cuIconfont-spin' : 'cuIconfont-spin'"></text>
					确认修改报价
				</button>
			</view>
		</view>
	</view>
</template>

<script>
import beeApp from '../../beeApp.js';

export default {
	data() {
		return {
			modalName: null,
			loadding: 0,
			name: '',
			phone: '',
			address: '',
			content: '',
			order_amount: '',
			remark: '',
			user_info: {
				community: {}
			}
		};
	},
	onLoad(option) {
		this.order_sn = option.order_sn;
		// beeApp.alert("yiqwyei");
		// beeApp.getUserInfo((userInfo)=>{
		//  // this.userInfo = userInfo;
		//   this.getUserInfo();
		// });
		// this.getLocation();
	},
	onShow: function() {},

	methods: {
		inputChange(e) {
			// console.log(e);
			var name = e.currentTarget.dataset.name;
			this[name] = e.detail.value;
		},

		postForm: function() {
			var that = this;
			if (that.loadding == 1) {
				return;
			}

			if (this.order_amount == '') {
				beeApp.alert('请输入价格');
				return;
			}
			that.loadding = 1;
			beeApp.api(
				'apiv2/dao_jia/updatePrice',
				{
					order_amount: this.order_amount,
					order_sn: this.order_sn,
					method: 'POST'
				},
				function(res) {
					that.loadding = 0;
					if (res.code != 200) {
						beeApp.alert(res.msg);
						return;
					}
					beeApp.setPageData('pages/order/detail', { reload: 1 });
					beeApp.alert('恭喜您,修改成功！', function() {
						uni.navigateBack();
					});
				}
			);
		}
	}
};
</script>
